import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-07-13
 * Time: 11:20
 */
public class test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int q = in.nextInt();
        for(int k=0;k<q;k++){
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            // 用于记录分数
            int sum = 0;
            // 找到最小的那个数
            int x = Math.min(Math.min(a,b),c);
            sum += x*2;
            b = b-x;
            if(b>2){
                sum += b-1;
            }else if(b==2){
                sum +=1;
            }
            System.out.println(sum);
        }
    }
}
